// bin
package main

import (
	"fmt"
)

func JoinToUint16(high, low byte) uint16 {
	return uint16(high)<<8 | uint16(low)
}

//向crc16追加到dat末尾
func SplitUint16(crc16 uint16) (high, low byte) {
	low = byte(crc16)
	high = byte(crc16 >> 8)
	return high, low
}

//字符集转换
func UseNewEncoder(src string, oldEncoder string, newEncoder string) string {
	srcDecoder := mahonia.NewDecoder(oldEncoder)
	desDecoder := mahonia.NewDecoder(newEncoder)
	resStr := srcDecoder.ConvertString(src)
	_, resBytes, _ := desDecoder.Translate([]byte(resStr), true)
	return string(resBytes)
}
